package com.hxx.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hxx.entity.TrainEntity;
import com.hxx.mapper.TrainMapper;
import com.hxx.service.TrainService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class TrainServiceImpl extends ServiceImpl<TrainMapper, TrainEntity>
implements TrainService {

    @Autowired
    private TrainMapper trainMapper;
    @Override
    public Page<TrainEntity> listPage(Page<TrainEntity> page, TrainEntity entity) {
        return trainMapper.selectPage(page,new LambdaQueryWrapper<TrainEntity>()
                .like(entity.getCode()!=null,TrainEntity::getCode,entity.getCode())
                .like(entity.getType()!=null,TrainEntity::getType,entity.getType())
        );
    }
}
